/**
 * 
 */
package cn.edu.thsis.service.impl;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;

import cn.edu.thsis.dao.NewsInfoDao;
import cn.edu.thsis.dao.impl.NewsInfoDaoImpl;
import cn.edu.thsis.pojo.mess;
import cn.edu.thsis.pojo.newsinfo;
import cn.edu.thsis.service.NewsInfoService;

public class NewsInfoServiceImpl implements NewsInfoService {

	private NewsInfoDao niDao = new NewsInfoDaoImpl();
	
	@Override
	public List<newsinfo> finNewsInfoAll() throws SQLException {
		
		return niDao.getNewsInfoList();
	}

	@Override
	public boolean insertNewsInfo(newsinfo ni) {
		if(ni!=null) {
			ni.setCreateDate(new Date(System.currentTimeMillis())); 
			return niDao.insert(ni);
		}
		return false;
	}

	@Override
	public boolean updateNewsInfo(newsinfo ni) {
		if(ni!=null) {
			return niDao.update(ni);
		}
		return false;
	}

	@Override
	public boolean deleteNewsInfo(String nid) {
		if(nid!=null) {
			return niDao.delete(nid);
		}
		return false;
	}

	@Override
	public newsinfo newcontService(String nid) {
			return niDao.newcontDao(nid);
	}

	@Override
	public boolean messService(mess mes) {
		if (mes!=null) {
			mes.setWtime(new Date(System.currentTimeMillis()));
			return niDao.messDao(mes);
		}return false;
	}

}
